package com.zmh.dao.http;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.zmh.entity.BookEntity;
import com.zmh.entity.CatalogEntity;
import com.zmh.entity.Ichange;
import com.zmh.entity.IssueEntity;
import com.zmh.entity.OamsgEntity;


/** 
 * OA消息操作类
 * @author zhoumh
 * @version 创建时间：2018年7月15日 上午10:10:10 
 * @Description 
*/
@Mapper
public interface OamsgMapper {
	@Select("SELECT * FROM oamsg")
//	@Results({
//		@Result(property = "id",  column = "id"),
//		@Result(property = "uuid", column = "uuid"),
//		@Result(property = "name", column = "name"),
//		@Result(property = "count", column = "author"),
//		@Result(property = "description", column = "description")
//	})
	List<OamsgEntity> getAll();

	/**
	 * 根据父问题ID获取问题信息
	 * @return: IssueEntity
	 * @author: zhoumh
	 * @version: 创建时间：2018年7月22日 下午10:11:42 
	 * @Description:
	 */
	@Select("SELECT * FROM oamsg WHERE description = #{description} limit 1")
	OamsgEntity getOneByDesc(String description);

	
	/**
	 * 增加问题信息
	 * @return: int
	 * @author: zhoumh
	 * @version: 创建时间：2018年7月25日 下午3:58:32 
	 * @Description:
	 */
	@Insert("INSERT INTO oamsg(uuid, sendname, sendtime, title, type, description) VALUES(uuid(), #{sendname}, #{sendtime}, #{title}, #{type}, #{description})")
	int insert(OamsgEntity oamsgEntity);

	@Update("UPDATE oamsg SET sendname=#{sendname}, sendtime=#{sendtime}, title=#{title}, type=#{type}, state='1', updateTime=#{updateTime} WHERE uuid= #{uuid}")
	int update(OamsgEntity oamsgEntity);

	@Delete("DELETE FROM oamsg WHERE uuid =#{uuid}")
	int delete(String uuid);

}

